// Approximating PI by iterative approximation

import java.util.Scanner;

class Iteration {

  public static void main (String[] args)
  {
      Scanner scan = new Scanner(System.in);
      System.out.print ("Enter accuracy: ");
      double epsilon = scan.nextDouble();

      int n = 4;
      double s, c, inner = 2.0, outer = 4.0;
      c = 1 / Math.sqrt(2);
      while (outer-inner > epsilon) 
      {
          System.out.println (n + "\t" + inner + "\t" + outer);
          n = n * 2;
          s = Math.sqrt((1 - c) / 2);
          c = Math.sqrt((1 + c) / 2);
          inner = n * s * c;
          outer = n * s / c;
      }
  }
}
